
//1744.你能在你最喜欢的那天吃到你最喜欢的糖果吗？
class Solution {
    typedef long long LL;
public:
    vector<bool> canEat(vector<int>& candiesCount, vector<vector<int>>& queries) {
        //题目很长,但是理解后题目就很简单、
        //题目要求我们判断是否能在favoriteDayi吃到favoriteTypei糖,每天至少吃1颗糖,最多吃dailyCapi颗
        //吃糖的顺序必须是从下标0位置依次往后
        
        //所以使用前缀和来统计每种糖前面有多少颗糖
        int n = candiesCount.size(),m = queries.size();
        vector<LL> lsum(n+1);
        for(int i = 0;i < n;i++)
            lsum[i+1] = lsum[i] + candiesCount[i];

        vector<bool> ret;
        for(auto& nums: queries)
        {
            LL type = nums[0] ,day = nums[1] ,cap = nums[2];
            if((day+1)*cap > lsum[type] && day < lsum[type+1]) ret.push_back(true);
            else ret.push_back(false);
        }
        return ret;
    }
};